<!DOCTYPE html>
<html>
<head>
    <title>API</title>
    <meta charset="utf-8">
    <link href="../content/shared/styles/examples-offline.css" rel="stylesheet">
    <link href="../../styles/kendo.common.min.css" rel="stylesheet">
    <link href="../../styles/kendo.rtl.min.css" rel="stylesheet">
    <link href="../../styles/kendo.default.min.css" rel="stylesheet">
    <link href="../../styles/kendo.dataviz.min.css" rel="stylesheet">
    <link href="../../styles/kendo.dataviz.default.min.css" rel="stylesheet">
    <script src="../../js/jquery.min.js"></script>
    <script src="../../js/kendo.all.min.js"></script>
    <script src="../content/shared/js/console.js"></script>
    <script>
        
    </script>
    
    
</head>
<body>
    
        <a class="offline-button" href="../index.html">Back</a>
    
    <div id="example">
    <div class="box" id="mapConfig">
        <div class="box-col">
            <h4>Center</h4>
            <ul class="options">
                <li>
                    <input id="centerLat" data-role="numerictextbox"
                           data-format="N4" value="30.2681" data-decimals="4" />
                    <input id="centerLng" data-role="numerictextbox"
                           data-format="N4" value="-97.7448" data-decimals="4" />
                    <button id="center" class="k-button">center()</button>
                </li>
            </ul>
        </div>
        <div class="box-col">
            <h4>Zoom level</h4>
            <ul class="options">
                <li>
                   <select id="zoomLevel" data-role="dropdownlist">
                        <option value="1">1 (min)</option>
                        <option value="2">2</option>
                        <option value="3" selected="selected">3</option>
                        <option value="4">4</option>
                        <option value="5">5</option>
                        <option value="6">6</option>
                        <option value="7">7</option>
                        <option value="8">8</option>
                        <option value="9">9</option>
                        <option value="10">10</option>
                        <option value="11">11</option>
                        <option value="12">12</option>
                        <option value="13">13</option>
                        <option value="14">14</option>
                        <option value="15">15</option>
                        <option value="16">16</option>
                        <option value="17">17</option>
                        <option value="18">18 (max)</option>
                    </select>
                    <button id="zoom" class="k-button">zoom()</button>
                </li>
            </ul>
        </div>
    </div>
    <div class="demo-section k-header" style="padding: 1em;">
        <div id="map"></div>
    </div>
    <script>
        function createMap() {
            $("#map").kendoMap({
                center: [30.2681, -97.7448],
                zoom: 3,
                layers: [{
                    type: "tile",
                    urlTemplate: "http://tile2.opencyclemap.org/transport/#= zoom #/#= x #/#= y #.png",
                    subdomains: ["a", "b", "c"],
                    attribution: "&copy; <a href='http://osm.org/copyright'>OpenStreetMap</a> contributors"
                }],
                panEnd: updateControls,
                zoomEnd: updateControls
            });
        }

        $(document).ready(createMap);

        kendo.init($("#mapConfig"));

        $("#center").click( function (e) {
            $("#map").data("kendoMap").center([
                parseFloat($("#centerLat").val()),
                parseFloat($("#centerLng").val())
            ]);
        });

        $("#zoom").click( function (e) {
            $("#map").data("kendoMap").zoom(
                parseInt($("#zoomLevel").val(), 10)
            );
        });

        function updateControls() {
            var map = $("#map").data("kendoMap");
            var center = map.center();

            if (kendo.ui.NumericTextBox) {
                $("#centerLat").data("kendoNumericTextBox").value(center.lat);
                $("#centerLng").data("kendoNumericTextBox").value(center.lng);
                $("#zoomLevel").data("kendoDropDownList").value(map.zoom());
            }
        }

    </script>
</div>


    
    
        <div class='demo-section'>
            <h3>Note:</h3>
            <p>
                Security restrictions prevent this example from working in all browsers when the page is loaded from the file system (via file:// protocol).
                If the demo is not working as expected, please host the Kendo folder on a web server.
            </p>
        </div>
    
</body>
</html>
